<template>
<Card class="port-con">
  <Row>
    <Col span="6" offset="9">
      <Form :label-width="100">
        <FormItem label="访问地址：">
          {{myUrl}}
        </FormItem>
        <FormItem label="用户名：">
          {{account}}
        </FormItem>
        <FormItem label="密码：">
          {{password}}
        </FormItem>
        <FormItem label="使用说明：">
          {{description}}
        </FormItem>
      </Form>
    </Col>
  </Row>
</Card>
</template>

<script>
export default {
  data () {
    return {
			myUrl: '',
			containerName: '',
			account: '',
			password: '',
			description: ''
    }
  },
  methods: {
		getList () {
			this.$api.get(0, '/kuber/con/page/info?page=1&limit=5&owner=' + sessionStorage.username + '&containerName=' + sessionStorage.containerName, {}, r => {
				if (r.data.code === 0) {
					let myDate = r.data.data.data[0]
					this.containerName = myDate.podName
					this.$api.get(0, '/kuber/con?containerName=' + this.containerName + '&owner=' + sessionStorage.username, {}, r => {
						if (r.data.code === 0) {
							let myuuid = r.data.data.uuid
							this.$api.get(0, '/kuber/description?uuid=' + myuuid, {}, r => {
								if (r.data.code === 0) {
									// 调用地址
									this.myUrl = r.data.data.url + ':' + r.data.data.port
									this.account = r.data.data.account
									this.password = r.data.data.password
									this.description = r.data.data.description
								}
							})
						}
					})
				}
			})
		}
  },
  mounted () {
		this.user = JSON.parse(sessionStorage.user)
		this.getList()
  }
}
</script>

<style lang="scss">
.port-con{
  padding: 30px 0;
  .ivu-form .ivu-form-item-label, .ivu-form-item-content{
    font-size: 16px;
  }
	.ivu-form-item-content{
		line-height: 55px;
	}
}
</style>
